package 移动零;

class Solution {
    public void moveZeroes(int[] nums) {
        int dest = -1;
        int cur  = 0;
        for(; cur < nums.length ; cur++){
            if(nums[cur] != 0){
                swap(dest+1,cur,nums);
                dest++;
            }
        }
    }
    private void swap(int x, int y,int[] arr){
        int tmp = arr[x];
        arr[x] = arr[y];
        arr[y] = tmp;
    }
}